package com.dhcc.DRGsHosp.facade.impl.assembler;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.dhcc.DRGsHosp.core.domain.MrqScoreDetail;
import com.dhcc.DRGsHosp.facade.dto.MrqScoreDetailDTO;

public class MrqScoreDetailAssembler {

	public static MrqScoreDetailDTO toDTO(MrqScoreDetail mrqScoreDetail){
		if( mrqScoreDetail == null ){
			return null;
		}
		MrqScoreDetailDTO mrqScoreDetailDTO = new MrqScoreDetailDTO();
		//没有setId
		mrqScoreDetailDTO.setDetailCode(mrqScoreDetail.getDetailCode());
		mrqScoreDetailDTO.setDetailDeduction(mrqScoreDetail.getDetailDeduction());
		mrqScoreDetailDTO.setPmainIndex(mrqScoreDetail.getPmainIndex());
		mrqScoreDetailDTO.setScoreCode(mrqScoreDetail.getScoreCode());
		mrqScoreDetailDTO.setWeightCode(mrqScoreDetail.getWeightCode());
		
		return mrqScoreDetailDTO;
	}
	
	public static List<MrqScoreDetailDTO>  toDTOs(Collection<MrqScoreDetail>  mrqScoreDetailMore){
		if ( mrqScoreDetailMore == null) {
			return null;
		}
		List<MrqScoreDetailDTO> mdrdList = new ArrayList<MrqScoreDetailDTO>();
		for (MrqScoreDetail mrqScoreDetail : mrqScoreDetailMore) {
			mdrdList.add( toDTO(mrqScoreDetail) );
		}
		return mdrdList;		
	}
	
	public static MrqScoreDetail toEntity(MrqScoreDetailDTO mrqScoreDetailDTO){
		if( mrqScoreDetailDTO == null ){
			return null;
		}
		MrqScoreDetail mrqScoreDetail = new MrqScoreDetail();
		//没有setId
		mrqScoreDetail.setDetailCode(mrqScoreDetailDTO.getDetailCode());
		mrqScoreDetail.setDetailDeduction(mrqScoreDetailDTO.getDetailDeduction());
		mrqScoreDetail.setPmainIndex(mrqScoreDetailDTO.getPmainIndex());
		mrqScoreDetail.setScoreCode(mrqScoreDetailDTO.getScoreCode());
		mrqScoreDetail.setWeightCode(mrqScoreDetailDTO.getWeightCode());	
		
		return mrqScoreDetail;
	}
	
	public static List<MrqScoreDetail>  toEntities(Collection<MrqScoreDetailDTO>  mrqScoreDetailDTOMore){
		if ( mrqScoreDetailDTOMore == null) {
			return null;
		}
		List<MrqScoreDetail> mdrList = new ArrayList<MrqScoreDetail>();
		for (MrqScoreDetailDTO mrqScoreDetailDTO : mrqScoreDetailDTOMore) {
			mdrList.add( toEntity(mrqScoreDetailDTO) );
		}
		return mdrList;		
	}
	
}
